package com.nw.utils;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class RequestUtil {
    public static  Map<String, Object>  getQuery(HttpServletRequest request ){
        Map<String, Object> query = new HashMap<>();
        Map<String, String[]> map = request.getParameterMap();
        Set<Map.Entry<String, String[]>> set = map.entrySet();
        Iterator<Map.Entry<String, String[]>> it = set.iterator();
        while (it.hasNext()) {
            Map.Entry<String, String[]> entry = it.next();
            //  sb.append(entry.getKey() + ":" + entry.getValue()[0] + ",");
            if(entry.getValue()[0] == null || entry.getValue()[0].trim().equals("") || entry.getKey().equals("tableName")) continue;
            query.put(entry.getKey(),entry.getValue()[0]);
        }
        return query;
    }
}
